/*
 * $HeadURL: $
 * $Id: $
 * Copyright (c) 2011 by Ericsson, all rights reserved.
 */

package android.views;

import android.app.Activity;
import android.os.Bundle;
import android.test.R;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Gallery;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

/**
 *
 * @author xyonton
 * @version $Revision: $
 */
public class HelloGallery extends Activity {
    /** Revision of the class */
    public static final String _REV_ID_ = "$Revision: $";

    public static int          screenWidth;

    public static int          screenHeight;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        screenWidth = this.getWindowManager().getDefaultDisplay().getWidth();
        screenHeight = this.getWindowManager().getDefaultDisplay().getHeight();

        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_gallery);

        Gallery gallery = (Gallery) findViewById(R.id.gallery);
        gallery.setAdapter(new ImageAdapterGallery(this));

        gallery.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView parent, View v, int position, long id) {
                Toast.makeText(HelloGallery.this, "" + position, Toast.LENGTH_SHORT).show();
            }
        });
    }
}
